﻿if (SUPPORT_DYNAMIC_LIBRARY)             # 动态库
    if (SUPPORT_CUDA_GPUS)
        set(MIDDLEWARE_LIB_NAME ${ROOT_PATH}/middleware/cuda/libMiddleware.so)
    else ()
        set(MIDDLEWARE_LIB_NAME ${ROOT_PATH}/middleware/libMiddleware.so)
    endif ()
else ()                                  # 静态库
    if (SUPPORT_CUDA_GPUS)
        set(MIDDLEWARE_LIB_NAME ${ROOT_PATH}/middleware/cuda/libMiddleware.a)
    else ()
        set(MIDDLEWARE_LIB_NAME ${ROOT_PATH}/middleware/libMiddleware.a)
    endif ()
endif ()

# 提前拷贝Middleware和依赖
if (${SUPPORT_DYNAMIC_LIBRARY})
    if(NOT EXISTS ${LIBRARY_OUTPUT_PATH}/libMiddleware.so)
        FILE(COPY "${MIDDLEWARE_LIB_NAME}" DESTINATION ${LIBRARY_OUTPUT_PATH})
    endif()
endif ()
if(NOT EXISTS ${LIBRARY_OUTPUT_PATH}/libZRDDSManager.so)
    FILE(COPY "${ROOT_PATH}/middleware/libZRDDSManager.so" DESTINATION ${LIBRARY_OUTPUT_PATH})
endif()
if(EXISTS ${ROOT_PATH}/middleware/libZRDDSManager_235.so AND NOT EXISTS ${LIBRARY_OUTPUT_PATH}/libZRDDSManager_235.so)
    FILE(COPY "${ROOT_PATH}/middleware/libZRDDSManager_235.so" DESTINATION ${LIBRARY_OUTPUT_PATH})
endif()
if(NOT EXISTS ${LIBRARY_OUTPUT_PATH}/libOpenDDSManager.so)
    FILE(COPY "${ROOT_PATH}/middleware/libOpenDDSManager.so" DESTINATION ${LIBRARY_OUTPUT_PATH})
endif()